<extend name="Public@Public/base" />
<block name="links">
</block>

<block name="main_content">



<div class="filter">
    <div class="row frow">
      <form action="" method="GET" name="form" class="myforms" id="to_search">
      {$saerchForm}
		<div class="col-md-3  col-xs-12 col-sm-3">
      <div class="btn-group">
        <a type="submit" class="btn btn-info" id="get_search">条件查询</a> 
        <a type="button" href="{:U($PUB_NODE)}" class="btn btn-primary" id="get_search">所有数据</a>  
      </div>
			
		</div>
      </form>

    </div>
</div>

<div class="sinfo alert alert-warning alert-dismissible fade in">
  共<span>{$all_count} </span> 条记录
</div>




<form id="form_list" name="form_list" action="" method="get">
<table class="table  datalist  table-hover">
  <thead>
    <tr>
      <th style="font-size:12px;">
        <input type="checkbox" class="select_all" name="select_all">
      </th>
      <if condition="$list_img_show neq false">
        <th>图片</th>
      </if>
      <foreach name="title_lists" item="row">
        <th>
          {$row}
          <if condition="$_GET['order_by'] neq $key.'|desc' and $_GET['order_by'] neq $key.'|asc'">
            <a href="{:add_url_parameter('order_by',$key.'|desc')}">
              <i class="iconfont" title="通过{$row}排序">&#xe63b;</i>
            </a>

          <elseif condition="$_GET['order_by'] eq $key.'|desc'"/>
            <a href="{:add_url_parameter('order_by',$key.'|asc')}">
              <i class="iconfont" title="通过{$row}升序排序">&#xe65c;</i>
            </a>


          <elseif condition="$_GET['order_by'] eq $key.'|asc'"/>
            <a href="{:add_url_parameter('order_by',$key.'|desc')}">
              <i class="iconfont" title="已经通过{$row}降序排列">&#xe66e;</i>
            </a>

          </if>

        </th>
      </foreach>
      <th class="tright pad-r21" scope="row">
      </th>
    </tr>
  </thead>
  <tbody>
    <foreach name="list_data" item="row" key='key'>
    <tr>
      <td style="font-size:12px;">
        <input type="checkbox" name="select_id[]" value="{$row['id']}">
      </td>
      <if condition="$list_img_show neq false">
        <td><img src="{$row[$list_img_show]}" width=42 height=42 style="border:1px solid #ccc;padding:2px;"></td>
      </if>
      <foreach name="title_lists" item="row1" key='key1'>
        <td>
          {$row[$key1]|get_model_value=$THIS_MODEL['model_name'],$key1}
        </td>
      </foreach>
      <td class="tright" scope="row">
        <foreach name="action_lists" item="act_row">
          <i class=""></i>
        <a href="{:U($act_row['node_name'],array('id'=>$row['id']))}"  onclick="{$act_row['pre_func']}();" class="abtn">{$act_row['title']}</a>&nbsp;
        </foreach>
      </td>
    </tr>
    </foreach>
  </tbody>
  <thead>
    <tr>
      <td style="font-size:12px;">
      </td>
      <if condition="$list_img_show neq false">
        <th>图片</th>
      </if>
      <foreach name="title_lists" item="row">
        <th>
          {$row}
        </th>
      </foreach>
      <th class="tright pad-r21" scope="row"></th>
    </tr>
  </thead>
  </table>
  </form>

  <div class="cobtn">

    <div class="comm_tools" style="margin: 8px 0px 5px 0px;">

      <if condition="$action_add_button neq false">
        <div class="btn-group" role="group" aria-label="...">
          <a type="button" class="btn btn-primary" href="{:U($action_add_button['node_name'])}">{$action_add_button['title']}+</a>
        </div>
      </if>


      <if condition="$common_action_button neq false">
        <foreach name="common_action_button" item="arow">
          <div class="btn-group" role="group" aria-label="...">
            <a  class="btn btn-info" onclick="comm_url1('{:U($arow[\'node_name\'])}','{$arow[\'is_select\']}','{$arow[\'action_info\']}')">
              {$arow['title']}
            </a>
          </div>
        </foreach>
      </if>

      <if condition="$delete_action_button neq false">
        <div class="btn-group" role="group" aria-label="...">
          <a type="button" class="btn btn-warning" onclick="comm_url1('{:U($delete_action_button[\'node_name\'])}','{$delete_action_button[\'is_select\']}','{$delete_action_button[\'action_info\']}')">{$delete_action_button['title']}</a>
        </div> 
      </if>
    
    </div>




    <form action="" method="GET" class="pagefm">
    <div class="page" style="height: auto;">{$page}&nbsp;&nbsp;
    </div>
    </form>

  </div>

</block>
<block name="script">
  <script type="text/javascript">
  $(".select_all").click(
    function(){
      if(this.checked){
        $("input[name='select_id[]']").each(function(){this.checked=true;});
      }else{
        $("input[name='select_id[]']").each(function(){this.checked=false;});
      }
    }
  );
      
      // 字符是否为空格处理避免出错
      function isNull( str ){
        if ( str == "" ) return true;
        var regu = "^[ ]+$";
        var re = new RegExp(regu);
        return re.test(str);
      }
      $("#get_search").click(function(){
        surl=$("#to_search").serializeArray();
        url="/";
        for (var i = 0; i < surl.length; i++) {
          if (!isNull(surl[i]['value'])) {
            // urlencode("辖区动态")
            url=url+surl[i]['name']+"/"+surl[i]['value']+"/";
          }
        }
        url = url.substr(0, url.length - 1);
        window.location.href=encodeURI(encodeURI("__ROOT__/{$PUB_NODE}"+url));
      });
  </script>
</block>